package top.lshaci.learning.jvm.ref;

import java.lang.ref.WeakReference;

/**
 * WeakReferenceTest
 *
 * @author lshaci
 * @date 2020/8/7 17:18
 * @since 1.0.0
 */
public class WeakReferenceTest {

    public static void main(String[] args) {
        WeakReference<SoftReferenceTest.User> wf = new WeakReference<>(new SoftReferenceTest.User(1, "lshaci"));
        // 存在
        System.err.println(wf.get());

        System.gc();
        System.err.println("After gc:");
        // null
        System.err.println(wf.get());
    }
}
